import { Request } from 'express';
import { JwtPayload } from 'jsonwebtoken';
import { Session } from 'express-session';

export interface User {
    id: number;
    username: string;
    nickname?: string;
    roleCode?: string;
    permissions?: string[];
    orgName?: string;
    orgId?: number;
}

export interface UserInfo extends Omit<User, 'password'> {
    token: string;
    avatar?: string;
}

export interface CustomSession extends Session {
    user?: UserInfo;
    captcha?: string;
}

export interface CaptchaResponse {
    success: boolean;
    message: string;
    error?: string;
}

export interface ApiResponse<T = any> {
    success: boolean;
    message: string;
    data?: T;
    error?: string;
}

export interface AuthUser {
    id: string;
    username: string;
    nickname: string;
    roleCode: string;
    orgId: string;
}

export interface AuthRequest extends Request {
    user?: any;
    session: CustomSession;
}

export interface DecodedToken extends JwtPayload, AuthUser {}

export interface PublicPath {
    path: string;
    method?: string;
} 